<?php
// +-----------------+-------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
// | Field           | Type                                                                                                  | Null | Key | Default | Extra          |
// +-----------------+-------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
// | id              | int(11)                                                                                               | NO   | PRI | NULL    | auto_increment |
// | user_id         | int(11) unsigned                                                                                      | NO   |     | 0       |                |
// | article_id      | int(11) unsigned                                                                                      | NO   |     | 0       |                |
// | title           | varchar(255)                                                                                          | NO   |     |         |                |
// | user_name       | varchar(50)                                                                                           | NO   |     |         |                |
// | birthday        | date                                                                                                  | YES  |     | NULL    |                |
// | id_num          | varchar(18)                                                                                           | YES  |     |         |                |
// | gender          | enum('secret','male','female','unknown')                                                              | YES  |     | secret  |                |
// | pro_title       | varchar(30)                                                                                           | YES  |     |         |                |
// | education       | enum('secret','zhongji','zhongzhuan','gaozhong','dazhuan','benke','shuoshi','boshi','boshihou','mba') | YES  |     | secret  |                |
// | email           | varchar(100)                                                                                          | YES  |     |         |                |
// | mobile          | varchar(15)                                                                                           | YES  |     |         |                |
// | college_name    | varchar(50)                                                                                           | YES  |     |         |                |
// | college_type    | varchar(30)                                                                                           | YES  |     |         |                |
// | college_no      | varchar(30)                                                                                           | YES  |     |         |                |
// | college_depart  | varchar(30)                                                                                           | YES  |     |         |                |
// | attachment_path | varchar(255)                                                                                          | YES  |     |         |                |
// | member_id       | int(11) unsigned                                                                                      | YES  |     | 0       |                |
// | create_time     | int(11) unsigned                                                                                      | YES  |     | 0       |                |
// | update_time     | int(11) unsigned                                                                                      | YES  |     | 0       |                |
// | delete_time     | int(11) unsigned                                                                                      | YES  |     | 0       |                |
// | attachment_name     | varchar(255)                                                                                          | YES  |     |         |                |
// +-----------------+-------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
namespace app\common\validate;

use think\Validate;

class Apply extends Validate
{
    protected $rule = [
        "user_id" => "require|gt:0",
        "article_id" => "require|gt:0",
        "title" => "require|min:3|max:50",
        "user_name" => "require|min:2|max:20",
        "birthday" => "require|after:1900-01-01",
        "id_num" => "require|length:18",
        "gender" => "require",
        "education" => "require",
        "pro_title" => "require|min:2|max:15",
        "email" => "require|email",
        "mobile" => "require|length:11",
        "college_name" => "require|min:4|max:15",
        "college_type" => "require|min:2|max:15",
        "college_no" => "require|min:2|max:15",
        "college_depart" => "require|min:2|max:15",
        "attachment_path" => "require",
        "attachment_name" => "require",
    ];

    protected $field = [
        "user_id" => "申请用户",
        "article_id" => "申报项目",
        "title" => "论文名称",
        "user_name" => "姓名",
        "birthday" => "出生年月",
        "id_num" => "身份证号",
        "gender" => "性别",
        "education" => "最高学历",
        "pro_title" => "职称",
        "email" => "邮箱",
        "mobile" => "手机号",
        "college_name" => "学校名称",
        "college_type" => "学校类型",
        "college_no" => "机构标识码",
        "college_depart" => "二级院校",
        "attachment_path" => "上传资料",
        "attachment_name" => "上传文件名",
    ];

    protected $message = [
        "user_id.require" => "申请用户不能为空",
        "user_id.gt" => "申请用户不能为空",
        "article_id.require" => "申报项目不能为空",
        "article_id.gt" => "申报项目不能为空",
        "title.require" => "论文名称不能为空",
        "title.min" => "论文名称长度必须在3-50个字符之间",
        "title.max" => "论文名称长度必须在3-50个字符之间",
        "user_name.require" => "姓名不能为空",
        "user_name.min" => "姓名长度必须在2-20个字符之间",
        "user_name.max" => "姓名长度必须在2-20个字符之间",
        "birthday.require" => "出生年月不能为空",
        "birthday.before" => "请输入真实的出生年月日期",
        "birthday.after" => "请输入真实的出生年月日期",
        "id_num.require" => "身份证号不能为空",
        "id_num.length" => "身份证号不正确",
        "gender.require" => "性别不能为空",
        "education.require" => "最高学历不能为空",
        "pro_title.require" => "职称不能为空",
        "pro_title.min" => "职称长度必须在2-15个字符之间",
        "pro_title.max" => "职称长度必须在2-15个字符之间",
        "email.require" => "邮箱不能为空",
        "email.email" => "邮箱格式不正确",
        "mobile.require" => "手机号不能为空",
        "mobile.length" => "手机号格式不正确",
        "college_name.require" => "学校名称不能为空",
        "college_name.min" => "学校名称长度必须在4-15个字符之间",
        "college_name.max" => "学校名称长度必须在4-15个字符之间",
        "college_type.require" => "学校类型不能为空",
        "college_type.min" => "学校类型长度必须在2-15个字符之间",
        "college_type.max" => "学校类型长度必须在2-15个字符之间",
        "college_no.require" => "机构标识码不能为空",
        "college_no.min" => "机构标识码长度必须在2-15个字符之间",
        "college_no.max" => "机构标识码长度必须在2-15个字符之间",
        "college_depart.require" => "二级院校不能为空",
        "college_depart.min" => "二级院校长度必须在2-15个字符之间",
        "college_depart.max" => "二级院校长度必须在2-15个字符之间",
        "attachment_path.require" => "上传资料不能为空",
        "attachment_name.require" => "上传文件名不能为空",
    ];
}